The present invention relates generally to the field of computer systems and applications that execute on them and, more particularly, to the automatic recovery of stateful application components when the computer system or process supporting the components fails.
A component is a discrete unit of code that delivers a specified set of services through specified interfaces. Components provide the services that clients request at run time. A stateful component maintains private state resulting from the execution of one or more method calls. Thus, for example, a client application connecting to a component can have a xe2x80x9cconversationxe2x80x9d with the component that spans multiple method calls. The component can retain state across those method calls.
Building stateful components is a useful approach in application design. Programmers typically write stateful applications that retain state across component method calls. This provides the information necessary for correct and successful execution across transaction boundaries. However, such stateful components have availability and scalability limitations. One problem with stateful applications is the risk of losing the volatile state as a result of component failure when the system or process supporting the stateful application fails. Such a failure typically requires human intervention to repair or restart the application. Service outages can be very long because of this. A conventional response to this problem is to insist that applications be stateless. A stateless application has xe2x80x9cno meaningful state maintained between transactionsxe2x80x9d. The loss of the component state prevents the masking of system failures from clients, and degrades application availability.
In view of the foregoing, there is a need for systems and methods that overcome the limitations and drawbacks of the prior art.
The present invention provides persistent stateful components via transparent logging and automatic recovery. Persistent component state is based on method logging, in which interactions between components are intercepted and stably logged. Information sufficient to re-create a component and reinstall state up to the point of the last logged interaction (e.g., via redo recovery of the logged method calls) is persisted on stable storage. In the event of a system failure, aspects of the present invention automatically recreate failed components and recover lost state, without the stateful application itself needing to take measures for its recovery.
An embodiment of the present invention allows stateful application components to begin and end transactions, and, because these components have a state outside of transactions (i.e., a state that can persist across system failures), they are able to recognize transaction error codes, and act on them accordingly. For example, such an application can test the error code and decide whether to simply re-execute the transaction or change input parameters before re-execution, and decide at what point to abandon the effort and return an error code to the caller describing what has happened.
Thus, component-based applications can be written xe2x80x9cnaturallyxe2x80x9d as stateful programs. The present invention deals with system failures by logging component interactions and possibly checkpointing state to ensure that the application state can be automatically recovered should a failure occur.
Other features of the invention are described below.